package cn.itcast.activemq.consumer.queue;

import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * Created by Think on 2017/9/22.
 */
@Component("queueConsumer2")
public class QueueConsumer2 implements MessageListener {

    public void onMessage(Message message) {
        TextMessage textMessage = (TextMessage)message;
        try {
            System.out.println("消费者QueueConsumer2获取信息："+textMessage.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
